class Solution {
public:
    vector<vector<int> > ret;
    vector<int> path;
    void backtrace(vector<int>& s,int cur){
        if(path.size() > 1){
            ret.push_back(path);
        }
        if(cur >= s.size()) return;
        
       // unordered_set<int> used;
        vector<int> used;
        for(int i = cur;i < s.size();i++){
            if(path.size() > 0 && s[i] < path.back() || find(used.begin(),used.end(),s[i]) != used.end() ){
                continue;
            }
                used.push_back(s[i]);
                path.push_back(s[i]);
                backtrace(s,i+1);
                path.pop_back();
            
        }
    }
    vector<vector<int>> findSubsequences(vector<int>& nums) {
        vector<int> used;
        backtrace(nums,0);
        return ret;
    }
};
